<template>
  <div>
    <h4 class="title">
      {{ title }}
      <h5>费用确认单</h5>
    </h4>
    <div class="main">
      <div class="topBox">
        <div class="topBoxFirst">
          <div v-if="data.yiyaBillingMain">
            接诊:{{ data.yiyaBillingMain.tc }}
          </div>
          <div>就诊医生:{{ data.doctor }}</div>
          <div v-if="data.yiyaMainClosingEntries">
            就诊日期:
            {{
              parseTime(data.yiyaMainClosingEntries.createTime, '{y}-{m}-{d}')
            }}
          </div>
          <div v-if="data.yiyaClinicPerson">
            姓名:{{ data.yiyaClinicPerson.name }}
          </div>
        </div>
      </div>
      <div class="mainBox">
        <div class="box1">
          <div>方案一:</div>
          <div
            v-for="(item, index) in data.yiyaItemBillingExtends"
            :key="index"
          >
            <div class="first">
              <div v-if="item.toothPosition" class="startDiv" style="width=20%">
                <div class="leftTop">
                  {{ item.toothPosition.split('|')[0].toString() }}
                </div>
                <div class="rightTop">
                  {{ item.toothPosition.split('|')[1].toString() }}
                </div>
                <div class="leftBtn">
                  {{ item.toothPosition.split('|')[2].toString() }}
                </div>
                <div class="rightBtn">
                  {{ item.toothPosition.split('|')[3].toString() }}
                </div>
              </div>
              <div style="width=30%">项目：{{ item.itemName }}</div>
              <div style="width=10%">{{ item.originalPrice }}</div>
              <div style="width=10%">{{ item.count }} {{ item.unit }}</div>
              <div style="width=30%">折后金额：{{ item.receivablePrice }}</div>
            </div>
          </div>
          <div class="second">
            <div v-if="data.total" style="width=30%">
              原价：{{ data.total.originalPrice }}
            </div>
            <div v-if="data.total" style="width=10%">
              折后金额：{{ data.total.discountPrice }}
            </div>
            <div v-if="data.total" style="width=10%">
              储值抵扣：{{ data.total.petCardAmount }}
            </div>
            <div v-if="data.total" style="width=30%">
              优惠抵扣：{{ data.total.deductionAmount }}
            </div>
          </div>
          <div class="third">
            <div style="width=30%"></div>
            <div style="width=10%"></div>
            <div v-if="data.total" style="width=10%">
              本次缴费：{{ data.total.payAmount }}
            </div>
            <div v-if="data.total" style="width=30%">
              本次欠费：{{ data.total.owingPrice }}
            </div>
          </div>
        </div>
      </div>
      <div class="box2">
        <div>方案二:</div>
      </div>
      <div class="box3">
        <div>方案三:其他</div>
      </div>
      <div class="box4">
        <div>备注:</div>
      </div>
    </div>
    <div class="mainFooter">
      <div class="FooterTop">
        以上方案，我同意按照第
        <div class="wire" contenteditable="true"></div>
        个方案。总计金额为：
        <div v-if="data.total" class="wire" contenteditable="true">
          {{ data.total.discountPrice }}
        </div>
        元
      </div>
      <div class="FooterBtn">
        <div style="width: 32%">本人确认签字：</div>
        <div>家属确认签字：</div>
        <div>日期：</div>
      </div>
    </div>
  </div>
</template>

<script>
/** TC——今日看诊——开单操作——开完单 */
export default {
  name: 'Billing',
  props: {
    data: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      title: '湖北咿呀连锁品牌',
    }
  },
  mounted() {
    setTimeout(() => {
      console.log(this.data)
    }, 300)
  },
}
</script>

<style lang="scss" scoped>
.dialog-title,
h5 {
  letter-spacing: 15px;
  margin-bottom: 15px;
}
.title {
  text-align: center;
  letter-spacing: 2em;
}
.main {
  display: flex;
  flex-direction: column;
  .topBox {
    display: flex;
    flex-direction: column;
    .topBoxFirst {
      display: flex;
      flex-wrap: nowrap;
      justify-content: space-between;
      padding: 10px 0;
    }
    .topBoxFirst div {
      text-align: center;
      width: 25%;
    }
  }
  .mainBox {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid black;

    .box1 {
      display: flex;
      flex-direction: column;
      min-height: 155px;
      border-bottom: 1px solid #000;
      padding: 5px;
      .first {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        margin-top: 6px;
        width: 100%;
        .startDiv {
          display: flex;
          flex-wrap: wrap;
          flex-direction: row;
          justify-content: space;
          width: 130px;
          height: 35px;
          text-align: center;
          div {
            width: 50%;
            height: 50%;
            text-align: center;
          }
          .leftTop {
            border-right: 1px solid #666;
            border-bottom: 1px solid #666;
          }
          .rightTop {
            border-left: 1px solid #666;
            border-bottom: 1px solid #666;
          }
          .leftBtn {
            border-right: 1px solid #666;
            border-top: 1px solid #666;
          }
          .rightBtn {
            border-left: 1px solid #666;
            border-top: 1px solid #666;
          }
        }
      }
      .second {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        width: 100%;
        margin: 12px 0;
        // div {
        //   width: 25%;
        //   text-align: center;
        // }
      }
      .third {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        width: 100%;
        // div {
        //   width: 25%;
        //   text-align: center;
        // }
      }
    }
  }

  .box2 {
    display: flex;
    flex-direction: column;
    min-height: 155px;
    border-bottom: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    padding: 5px;
  }
  .box3 {
    display: flex;
    flex-direction: column;
    min-height: 155px;
    border-bottom: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    padding: 5px;
  }
  .box4 {
    display: flex;
    flex-direction: column;
    min-height: 155px;
    border-bottom: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    padding: 5px;
  }
}
.mainFooter {
  display: flex;
  flex-direction: column;
  .FooterTop {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    margin: 14px 0;
    .wire {
      border-bottom: 1px solid #000;
      width: 60px;
      text-align: center;
    }
  }
  .FooterBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 14px 0;
    div {
      text-align: center;
      width: 25%;
    }
  }
}
</style>
